<script setup>
import {onMounted,ref} from "vue"
import NavGroup from "./components/NavGroup.vue";
import {queryNavType,queryNavList} from "@/api/common.js"
let navTypeList = ref([]);
let navList = ref([]);
onMounted(()=>{
  console.log("刷新")
  getList();
  getnavList();
})


const getList = async()=>{
  const res = await queryNavType();
  console.log("导航",res)
  navTypeList.value = res.data;
}

const getnavList = async () => {
  const res = await queryNavList();
  console.log(res,"navlist")
  navList.value = res.data;
};
</script>

<template>
  <div class="container">
    <NavGroup v-for="item in navTypeList" :key="item.id" :typeId="item.id" :list="navList" v-if="navTypeList.length>0"></NavGroup>
  </div>
</template>

<style scoped lang="scss">
.container {
  margin: 0 auto;
  margin-top: 20px;
  // background: red;
  width: 70%;
}
@media screen and (max-width:1000px) {
  .container {
    width:100%;
  padding:0 10px;
  }
}
</style>
